<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/4/20/020
 * Time: 10:37
 */

namespace app\index\controller;


use app\Lib\Api\Order\getMyOrderLog;
use app\Lib\TopClient;
use think\Controller;

class SiteLog extends Base
{
    public function index(){

        $order_number = input('order_number','');
        $info = $this->getMySiteInfo($order_number);
        $this->assign('info',$info);
        return $this->fetch();
    }

    /**
     * @param string $order_number
     * @return array|string
     * @throws \Exception
     */
    private function getMySiteInfo($order_number = ''){
        try{
            $model = new getMyOrderLog();
            $model->setArgs('opUid',$this->login_uid);
            if($order_number){
                $model->setArgs('order_number',$order_number);
            }
            $info= (new TopClient($model))->getSuccessData();
//            dump($info);
            if(empty($info)){
                $info = [
                    'design_user'=>'朱文杰',
                    'site_supervisor_uid'=>'陈绪栋',
                    'duration'=>'90天',
                    'startWord'=>'2019-04-10',
                    'orderStatus'=>'施工中',
                    'endWord'=>'2019-07-09',
                    'orderStyle'=>'新中式',
                    'user_address'=>'尚湖湾4栋502工地日志',
                    'orderLogPage'=>'10',
                    'order_number'=>'123456',
                    'user_address_array'=>[

                    ],
                    'VrUrl'=>'https://vr.justeasy.cn/view/5222948.html?from=singlemessage&isappinstalled=0',
                    'orderImg'=>[
                        '\uploads\sys\xiaoguotu1.jpg',
                        '\uploads\sys\xiaoguotu2.jpg',
                        '\uploads\sys\shigongtu.jpg',
                    ],
                    'orderLog'=>[
                        '2019-05-03'=>[
                            'msg'=>'水电布局全景图',
                            'url'=>'http://720a.cn/p/07775db0?from=timeline&isappinstalled=0'
                        ],
                        '2019-05-02'=>[
                            'msg'=>'今日完成水电布局',
                            'file'=>[
                                '\uploads\sys\shuidian1.jpg',
                                '\uploads\sys\shuidian2.jpg',
                                '\uploads\sys\shuidian3.jpg'
                            ]
                        ],
                        '2019-05-01'=>[
                            'msg'=>'今天水电定位成功',
                            'file'=>[
                                '\uploads\sys\dingwei1.jpg',
                                '\uploads\sys\dingwei2.jpg',
                            ]
                        ],
                        '2019-04-30'=>[
                            'msg'=>'测试数据，无法更新，只供观看',
                        ]
                    ],
                ];
            }
            return $info;
        }catch (\Exception $e){
            echo  $e->getMessage();
        }
    }

}